package fm

import (
	"gitee.com/xluomo945/fm/helper"
	"gitee.com/xluomo945/fm/log"
	syslog "log"
)

func (app *App) initLogger() error {
	// 类型为空的情况下关闭日志
	if helper.StringEmpty(string(app.Type)) {
		syslog.Println("[Warn] logger is close")
		return nil
	}

	// 日志初始化
	err := log.Create(app.LoggerConfig, app.Middleware.UseTrace)
	if err != nil {
		return err
	}

	return nil
}
